package org.alex.sample.controller.converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.core.convert.converter.Converter;

public class CustomDateConverter implements Converter<String,Date> {

	@Override
	public Date convert(String arg0) {
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
		System.out.println(arg0);
		try {
			Date date = simpleDateFormat.parse(arg0);
			System.out.println(date);
			return date;
		} catch (ParseException e) {
			System.out.println("日期转换出错");
			e.printStackTrace();
		}

		return null;
	}

}
